﻿using Basic.FormRemoteModel.PhysicalQuery;
using Basic.FormRemoteModel.PhysicalQuery.Model;
using Basic.FormService.Interface;
using WeDonekRpc.Client.Interface;

namespace Basic.FormService.RpcEvent
{
    internal class PhysicalQueryEvent : IRpcApiService
    {
        private readonly IPhysicalQueryService _Service;

        public PhysicalQueryEvent ( IPhysicalQueryService service )
        {
            this._Service = service;
        }
        public PhysicalQueryData[] GetPhysicalQuerys ( GetPhysicalQuerys obj )
        {
            return this._Service.Gets(obj.FormId, obj.Location);
        }
        public void SetPhysicalQuerySort ( SetPhysicalQuerySort obj )
        {
            this._Service.SetSort(obj.Sorts);
        }
        public long AddPhysicalQuery ( AddPhysicalQuery data )
        {
            return this._Service.Add(data.Datum);
        }

        public void DeletePhysicalQuery ( DeletePhysicalQuery obj )
        {
            this._Service.Delete(obj.Id);
        }

        public PhysicalQueryDto GetPhysicalQuery ( GetPhysicalQuery obj )
        {
            return this._Service.Get(obj.Id);
        }

        public PhysicalQueryBody GetPhyQueryBody ( GetPhyQueryBody obj )
        {
            return this._Service.GetBody(obj.FormId);
        }

        public bool SetPhysicalQuery ( SetPhysicalQuery set )
        {
            return this._Service.Update(set.Id, set.Datum);
        }
    }
}
